* Use File::transform() in the core instead of the deprecated File::getThumbnail().
}
if( isset( $prop['url'] ) ) {
if( !is_null( $scale ) && !$file->isOld() ) {
- $thumb = $file->getThumbnail( $scale['width'], $scale['height'] );
- if( $thumb )
+ $mto = $file->transform( array( 'width' => $scale['width'], 'height' => $scale['height'] ) );
+ if( $mto && !$mto->isError() )
{
- $vals['thumburl'] = wfExpandUrl( $thumb->getURL() );
- $vals['thumbwidth'] = $thumb->getWidth();
- $vals['thumbheight'] = $thumb->getHeight();
+ $vals['thumburl'] = $mto->getUrl();
+ $vals['thumbwidth'] = $mto->getWidth();
+ $vals['thumbheight'] = $mto->getHeight();
}
}
$vals['url'] = $file->getFullURL();
*
* @param integer $width maximum width of the generated thumbnail
* @param integer $height maximum height of the image (optional)
- * @param boolean $render True to render the thumbnail if it doesn't exist,
- * false to just return the URL
+ * @param boolean $render Deprecated
*
* @return ThumbnailImage or null on failure
*
if ( $height != -1 ) {
$params['height'] = $height;
}
- $flags = $render ? self::RENDER_NOW : 0;
return $this->transform( $params, $flags );
}
# Show a thumbnail of the file
$img = wfFindFile( $title );
if ( $img ) {
- $thumb = $img->getThumbnail( 120, 120 );
+ $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) );
if( $thumb ) {
$wgOut->addHTML( '<div style="float:' . $align . '" id="mw-fileduplicatesearch-icon">' .
$thumb->toHtml( array( 'desc-link' => false ) ) . '<br />' .
if( $t->getNamespace() == NS_IMAGE ) {
$img = wfFindFile( $t );
if( $img ) {
- $thumb = $img->getThumbnail( 120, 120 );
+ $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) );
if( $thumb ) {
$desc = $img->getShortDesc();
wfProfileOut( $fname );